package com.jic.weamop.weBankAMOP.common.dto.response;


import com.jic.weamop.weBankAMOP.common.constants.ResultEnum;
import lombok.Data;

/**
 * 响应结果
 * @author v_wbgyang
 *
 * @param <T>
 */
@Data
public class ResponseData<T> {
	/**状态码*/
    private int errorCode;
	/**实际结果*/
	private T result;
	/**失败状态下的描述*/
	private String errorMsg;

    public ResponseData(ResultEnum resultEnum, T result) {
        this.errorCode = resultEnum.getCode();
        this.result = result;
        this.errorMsg = resultEnum.getCodeDesc();
    }

    public ResponseData() {
    	//默认状态
        this.errorCode = ResultEnum.SUCCESS.getCode();
        this.errorMsg = ResultEnum.SUCCESS.getCodeDesc();
    }

    public void setResultEnum(ResultEnum resultEnum) {
        this.errorCode = resultEnum.getCode();
        this.errorMsg = resultEnum.getCodeDesc();
    }
}
